#include "qclientsocket.h"
#include "qmsg.h"

 //构造函数
QClientSocket::QClientSocket(QObject *parent) : QUdpSocket(parent)
{
    this->bind();
};

//析构函数
QClientSocket::~QClientSocket(){

}

//发送消息
void QClientSocket::sendMsg(QMsg *pMsg)
{
    if(!pMsg){
        return;
    }

    //发送数据
    pMsg->pack();
    writeDatagram(pMsg->buf.data(), pMsg->buf.size(), QHostAddress(pMsg->tarIP), pMsg->tarPort);
}
